#include "ParametricCurves.h"

using namespace cagd;

//ezt meg kell irni
ParametricCurve::ParametricCurve(
        GLdouble a, GLdouble b,
        RowMatrix<ptrCoordinateFunction>derivative,
        GLuint div_point_count):
        GenericCurve(div_point_count, derivative.GetColumnCount() - 1),
        _a(a), _b(b),
        _der(derivative),
        _div_point_count(div_point_count)
{
    GLuint derivative_count = _derivative.GetRowCount();
    if (derivative_count)
    {
        GLdouble du = (b - a)/(_div_point_count - 1);
        for (GLuint i = 0; i < _div_point_count; i++)
        {
            GLdouble u = a + i * du;
            for (GLuint d = 0; d < derivative_count; ++d)
                SetDerivative(d, i, _der(d)(u));
        }
    }
}
